<template>
  <div class="user-exam-record">
    <el-table :data="examRecordList" border>
      <el-table-column align="center" label="考试时间" width="270">
        <template slot-scope="scope">{{scope.row.examStartTime}} 至 {{scope.row.examEndTime}}</template>
      </el-table-column>
      <el-table-column align="center" prop="examName" label="考试名称" />
      <el-table-column align="center" prop="score" label="分数" />
      <el-table-column align="center" prop="institutional" label="组织/考核机构" />
      <el-table-column align="center" prop="isPass" label="考试是否合格">
        <template slot-scope="scope">
          <el-tag type="danger" v-if="scope.row.isPass === 0">不合格</el-tag>
          <el-tag type="success" v-else>合格</el-tag>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: 'userExamRecord',
  data() {
    return {
      examRecordList: []
    }
  },
  props: {
    userId: {
      type: String,
      required: true
    }
  },
  methods: {
    async loadExamRecordList() {
      var res = await this.$http.post('/exam-admin/exam/getExamRecords', {
        page: 1,
        limit: 1000,
        userId: this.userId,
        examType: 1
      })
      this.examRecordList = res.data.list
    }
  },
  created() {
    this.loadExamRecordList()
  }
}
</script>

<style>
</style>